private List<Dictionary<string, object>> DataTableToDictionary(DataTable dt)
{
var dictionaries = new List<Dictionary<string, object>>();
foreach (DataRow row in dt.Rows)
{
Dictionary<string, object> dictionary = Enumerable.Range(0, dt.Columns.Count).ToDictionary(i => dt.Columns[i].ColumnName, i => row.ItemArray[i]);
dictionaries.Add(dictionary);
}
return dictionaries;
}